Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 2x 2x 4x 4x 4x 4x 2x 2x 2x 2x 2x | 'use strict';
//https://github.com/techfort/LokiJS/wiki
const debug=require('debug')('koajs-toolkit:loggerLib');
module.exports = class DatabaseLib{
constructor(config) {
debug('%s', 'construct');
const loki = require('lokijs');
return new Promise(resolve => {
let db;
if (config.options && (config.options.autoload===true || config.options.autoload==='true')){
config.options.autoloadCallback = function(){
return resolve(db);
};
db=new loki(config.name || 'data/defaultLoki.db',config.options);
}else{
db=new loki(config.name || 'data/defaultLoki.db',config.options);
resolve(db);
}
});
}
}; |